<template>
  <div class="daily-main-box">
    <div class="empty-box" v-if="showEmpty">暂无数据！</div>
    <div v-else>
      <div
        class="list-item"
        v-for="(item, index) in dailyList"
        :key="index"
        @click="toDailyInfo(item)"
      >
        <div class="title-box">
          <div class="identifier-box"></div>
          <div class="title-type">{{ item.proshortname }}</div>
        </div>
        <div class="info-box">
          <div class="left-box">
            <div>填报人：</div>
            <div>填报日期：</div>
            <div>工作类型：</div>
            <div>今日已完成：</div>
          </div>
          <div class="right-box">
            <div>{{ item.creator }}</div>
            <div>{{ item.createtime.split("T")[0] }}</div>
            <div>{{ item.worktype }}</div>
            <div>{{ item.workcontent }}</div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    dailyList: {
      type: Array,
      default: null,
    },
    openInfoDrawer: {
      type: Function,
      default: null,
    },
  },
  watch: {
    dailyList(nv, ov) {
      if (!nv.length) {
        this.showEmpty = true;
      } else {
        this.showEmpty = false;
      }
    },
  },
  data() {
    return {
      openInfo: true,
      showEmpty: true,
    };
  },
  methods: {
    toDailyInfo(row) {
      this.openInfoDrawer(row);
    },
    clickProject(row, column, event) {
      if (!this.openInfo) return;
      this.openInfoDrawer(row);
    },
  },
};
</script>

<style lang="scss" scope>
.daily-main-box {
  /* border: 1px solid red; */
  /* background: #e8e9eb; */
  height: 91vh;
  padding-top: 10px;
  /* overflow: auto; */
  .empty-box {
    width: 100%;
    height: 460px;
    text-align: center;
    line-height: 460px;
  }
  .list-item {
    border: 1px solid #c4c0c0;
    border-radius: 15px;
    width: 92%;
    margin: 0 4%;
    margin-bottom: 10px;
    background: #fff;
    /* background: linear-gradient(#9ccaeb, #cfd5e7); */
    /* background: linear-gradient(50deg, #fff, #cfd5e7, #46a9f0); */

    .head-box {
      border-bottom: 1px solid #dddcdc;
      height: 30px;
      line-height: 30px;
      text-align: start;
      font-size: 13px;
      font-weight: bold;
      margin-top: 10px;
      margin-bottom: 10px;
      padding-left: 20px;
      display: flex;
      align-items: center;

      .identifier-box {
        height: 10px;
        width: 5px;
        margin-right: 6px;
        background: #11a70c;
      }
    }
    .title-box {
      border-bottom: 1px solid #dddcdc;
      height: 30px;
      line-height: 30px;
      text-align: start;
      font-size: 16px;
      font-weight: bold;
      margin-top: 10px;
      margin-bottom: 10px;
      padding-left: 20px;
      display: flex;
      align-items: center;

      .identifier-box {
        height: 10px;
        width: 5px;
        margin-right: 6px;
        background: #11a70c;
      }

      > div {
        font-size: 16px;
      }
      .title-type {
        margin-left: 5px;
      }
    }

    .info-box {
      /* border: 1px solid red; */
      display: flex;

      .left-box,
      .right-box {
        /* border: 1px solid blue; */
        padding-left: 5px;

        > div {
          height: 24px;
          line-height: 24px;
          font-size: 14px;
          overflow: hidden;
          text-overflow: ellipsis;
          display: -webkit-box;
          -webkit-line-clamp: 1;
          -webkit-box-orient: vertical;
        }
      }

      .left-box {
        width: 27%;
        text-align: end;
      }
      .right-box {
        width: 70%;
        text-align: start;
      }
    }
  }
  .el-drawer__header {
    margin-bottom: -30px !important;
  }
}

.el-drawer {
}
</style>